<!doctype html>
<html>
<head>
    <include file="public/head"/>
    <title>千佰特自定义模型管理</title>
    <meta name="description" content="千佰特自定义模型管理">
    <meta name="keywords" content="千佰特自定义模型管理">
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li><a href="{:cmf_plugin_url('QbtCustomModel://AdminIndex/index')}">模型管理</a></li>
        <li><a href="{:cmf_plugin_url('QbtCustomModel://AdminQbtCustomModel/add')}">添加模型</a></li>
		<li class="active"><a>字段管理</a></li>
		<li><a href="{:cmf_plugin_url('QbtCustomModel://AdminModelField/add',['model_id'=>$model_info['model_id']])}">添加字段</a></li>
    </ul>
    <form method="post" class="js-ajax-form margin-top-20" action="#">
        <div class="table_list">
            <table width="100%" class="table table-hover">
                <thead>
                <tr>
                    <th>排序</th>
                    <th>字段名</th>
                    <th>别名</th>
                    <th>字段类型</th>
                    <th>系统</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
				<?php if($list):?>
					<?php foreach($list as $val):?>
					<tr>
						<td><input name="list_orders[{$val.field_id}]" class="input-order valid" type="text" value="{$val['field_sort']|default='0'}" aria-invalid="false"></td>
						<td><?=$val['field_name']?></td>
						<td><?=$val['field_nikename']?></td>
						<td><?=$formtype[$val['field_type']]?></td>
						<td><?php if($val['field_is_default']==1):?>是<?php else:?>否<?php endif;?></td>
						<td>
						<?php if($val['field_is_default']==0):?>
							<a href="{:cmf_plugin_url('QbtCustomModel://AdminModelField/edit',['field_id'=>$val['field_id']])}">编辑</a>
							<a href="javascript:if(confirm('此操作不可恢复，确定要删除？')){window.location.href = '{:cmf_plugin_url('QbtCustomModel://AdminModelField/delete',['field_id'=>$val['field_id']])}'}">删除</a>
						<?php else:?>
						<a href="javascript:alert('系统字段不可编辑')">编辑</a>
						<a href="javascript:alert('系统字段不可删除')">删除</a>
						<?php endif;?>
						</td>
					</tr>
					<?php endforeach;?>
				<?php else:?>
				 <tr><td colspan="4">尚未添加字段，<a href="{:cmf_plugin_url('QbtCustomModel://AdminModelField/add',['model_id'=>$model_info['model_id']])}">立即添加</a></td></tr>
				<?php endif;?>
                </tbody>
            </table>
			<div class="table-actions">
                <button class="btn btn-primary btn-sm js-ajax-submit" type="submit" data-action="{:cmf_plugin_url('QbtCustomModel://AdminModelField/list_order')}">排序</button>
        </div>
        </div>
    </form>

</div>
<include file="public/scripts"/>
</body>
</html>